package com.nbicc.controller;

import com.nbicc.mapper.FinanMapper;
import com.nbicc.mapper.RecordMapper;
import com.nbicc.util.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: (描述):总览的查询
 * @Date: 2021/5/12 9:00
 * @Version 1.0 (版本)
 */
@RestController
@RequestMapping("/pandect")
public class PandectController {
    @Autowired
    private FinanMapper finanMapper;
    @Autowired
    private RecordMapper recordMapper;
    @GetMapping("/selectp")
    public JsonUtils selectP(){
        System.out.println("---selectP--");
        Double totalRow = finanMapper.totalRow();
        Double totalRowRecord = recordMapper.totalRowRecord();
        HashMap<Object, Object> map1 = new HashMap<>();
        map1.put("totalsum",totalRow);
        map1.put("summarysum",totalRowRecord);
        List<Object> list=new ArrayList<>();
        list.add(map1);
        JsonUtils<Object> jsonUtils = new JsonUtils<>();
        return jsonUtils.getJson(0,1,list,"");
    }
}
